package com.neo.pattern.strategy;

/**
 * @author neofaster
 */
public interface Picker <T>{
    /**
     * 决策快门和光圈值
     *
     * @param cameraControls
     * @param meter
     * @return
     */
    T pick(CameraControls cameraControls, LightMeter meter);

    /**
     *获取原原始的光圈值
     * @param cameraControls
     * @param lightMeter
     * @return
     */
    static Aperture apertureFixed(CameraControls cameraControls, LightMeter lightMeter){
        return cameraControls.getAperture();
    }

    /**
     * 获取原始的快门值
     * @param cameraControls
     * @param lightMeter
     * @return
     */
    static Shutter shutterFixed(CameraControls cameraControls, LightMeter lightMeter){
        return cameraControls.getShutter();
    }

    /**
     * 获取转化后的光圈值
     * @param cameraControls
     * @param lightMeter
     * @return
     */
    static Aperture pickAperture(CameraControls cameraControls, LightMeter lightMeter){
        return lightMeter.pickAperture(cameraControls.getFilmSpeed(), cameraControls.getShutter());
    }

    /**
     * 获取转化后的快门值
     * @param cameraControls
     * @param lightMeter
     * @return
     */
    static Shutter pickShutter(CameraControls cameraControls, LightMeter lightMeter){
        return lightMeter.pickShutter(cameraControls.getFilmSpeed(), cameraControls.getAperture());
    }
}
